package priv.hxm.view;

import java.io.IOException;

import org.apache.log4j.Logger;

import priv.mill.net.MyHttp;
import priv.mill.net.UrlType;


/*
 * 返回不同类型的myHttp
 */
public class MyHttpFactory {
	private static Logger logger = Logger.getLogger(MyHttpFactory.class);

	public static MyHttp getmyHttp(String text) {
		MyHttp myHttp = new MyHttp();
		if (text.startsWith("打开")) {
			myHttp.setMyUrl("Tools");
			try {
				if (text.startsWith("打开计算器"))
					Runtime.getRuntime().exec("C:/Windows/System32/calc.exe");
				if (text.startsWith("打开网易云"))
					Runtime.getRuntime()
							.exec("C:/Program Files (x86)/Netease/CloudMusic/cloudmusic.exe");

			} catch (IOException e) {
				e.printStackTrace();
			}
		} else if (text.startsWith("玩游戏")) {
			myHttp.setMyUrl("Plays");

		} else {
			myHttp.setMyUrl("Chat");
		}
		myHttp.setType(UrlType.NALMORE);
		myHttp.setData(text);
		return myHttp;
	}
}
